package com.qingcloud.adminbackend.enums;

/**
 * 设备编号批次状态
 */
public enum ProductTypeEnum {

    AIR_COMMON(1, "室内通用", "1", "https://wcenter.aitectcare.com/mobile/miniprogram/"),
    DECORATION(2, "室内装修", "2", "https://www.aitectcare.com/aitectcare-web/appurl/"),
    AEROSOL(11, "气溶胶", "3", "https://wcenter.waming-air.com/miniweb/"),
    OTHER(3, "室外设备", "8", "");

    /**
     * 编号
     */
    public int code;

    /**
     * 名称
     */
    public String name;

    /**
     * 设备编号第一位
     */
    public String idStart;

    /**
     * 二维码前缀
     */
    public String qrcodePrefix;

    ProductTypeEnum(int code, String name, String idStart, String qrcodePrefix) {
        this.code = code;
        this.name = name;
        this.idStart = idStart;
        this.qrcodePrefix = qrcodePrefix;
    }

    public static String getNameByCode(int code) {
        ProductTypeEnum[] uss = values();
        for (ProductTypeEnum us : uss) {
            if (us.code == code) {
                return us.name;
            }
        }
        return null;
    }

    public static ProductTypeEnum getByCode(int code) {
        ProductTypeEnum[] uss = values();
        for (ProductTypeEnum us : uss) {
            if (us.code == code) {
                return us;
            }
        }
        return ProductTypeEnum.OTHER;
    }
}
